#include "egraphicsobject.h"
#include "esprite.h"
#include "../animation/eanimationset.h"
#include "../eapplication.h"

EGraphicsObject::EGraphicsObject()
{

}

EGraphicsObject::~EGraphicsObject()
{

}

boost::shared_ptr<EGraphicsObject> EGraphicsObject::clone() const
{
    boost::shared_ptr<EGraphicsObject> newObject(new EGraphicsObject);

    newObject->m_sprite.reset(new ESprite);
    *newObject->m_sprite = *m_sprite;

    if(m_texture.lock())
    {
        newObject->m_texture = m_texture;
    }
    else
    {

    }

    return newObject;
}

void EGraphicsObject::update(float dt)
{
    // update current object animation, if any
    if(m_anims)
    {
        m_anims->update(dt);
    }
}

boost::shared_ptr<EAnimationSet> EGraphicsObject::anims() const
{
    return m_anims;
}

boost::shared_ptr<ETexture> EGraphicsObject::texture() const
{
    return m_texture.lock();
}

boost::shared_ptr<ESprite> EGraphicsObject::sprite() const
{
    return m_sprite;
}

